import Vue from 'vue'
import VueRouter from "vue-router";
Vue.use(VueRouter)

import Layout from '@/views/layout.vue'
import Ariticle from '@/views/article.vue'
import Collect from '@/views/collect.vue'
import Like from '@/views/like.vue'
import User from '@/views/user.vue'
import ArticleDetail from '@/views/article-detail.vue'


const router = new VueRouter({
  routes: [
  // 默认是layout页面
    {
      path: '/',
      redirect: '/article'
  },
    {
      path: '/layout',
      component: Layout,
      // 二级路由
      children: [
        {
          path: '/article',
          component:Ariticle,
        },
        {
          path: '/collect',
          component:Collect,
        },
        {
          path: '/like',
          component:Like,
        },{
          path: '/user',
          component:User,
        },
      ]
    },
    // 文章细节是一级路由
    {
      path: '/detail/:id',
      component: ArticleDetail,
    }
  ]
})

export default router